// eslint-disable-next-line
import { BasicLayout, BlankLayout, UserLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
// 目前是用 route.name 判断权限， 有 route.meta.childrenPermissions 的则用 route.meta.childrenPermissions 判断路由重定向
export const asyncRouterMap = [
  {
    path: '/',
    name: 'job:dirRoot',
    component: BasicLayout,
    redirect: '/dashboard/index',
    meta: { title: 'menu.home' },
    children: [
      {
        path: '/dashboard/index',
        name: 'pai_dashboard',
        component: () => import('@/pages/dashboard/index'),
        meta: {
          title: '首页',
          keepAlive: true,
          icon: 'home',
          permission: ['job:dirRoot', 'pai_dashboard']
        }
      },      
      {
        path: '/base-config',
        name: 'job:base',
        component: BlankLayout,
        meta: {
          title: '基础配置',
          keepAlive: true,
          icon: 'setting'
        },
        children: [
          {
            path: '/base-config/company',
            name: 'aibao_company',
            component: () => import('@/pages/base/company'),
            meta: { title: '保司管理', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'aibao_company'] }
          },
          {
            path: '/base-config/banner',
            name: 'job:base:banner',
            component: () => import('@/pages/base/banner'),
            meta: { title: 'banner管理', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'job:base:banner'] }
          },
          {
            path: '/base-config/vip',
            name: 'job:base:user',
            component: () => import('@/pages/base/vip'),
            meta: { title: '会员管理', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'job:base:user'] }
          },
          // {
          //   path: '/base-config/reward',
          //   name: 'job:base:reward',
          //   component: () => import('@/pages/base/reward'),
          //   meta: { title: '抽奖活动', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'job:base:reward'] }
          // },
          {
            path: '/base-config/dict',
            name: 'job:base:dict',
            component: () => import('@/pages/base/dict'),
            meta: { title: '字典列表', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'job:base:dict'] }
          },
          {
            path: '/base-config/role',
            name: 'job:base:role',
            component: () => import('@/pages/base/role'),
            meta: { title: '角色列表', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'job:base:role'] }
          },
          {
            path: '/base-config/globalConfig',
            name: 'pai_globalConfig',
            component: () => import('@/pages/base/globalConfig'),
            meta: { title: '全局参数配置', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'pai_globalConfig'] }
          },
          {
            path: '/base-config/sysPermission',
            name: 'pai_menu',
            component: () => import('@/pages/base/sysPermission'),
            meta: { title: '权限菜单', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'pai_menu'] }
          }
          // {
          //   path: '/base-config/bot',
          //   name: 'pai_bot',
          //   component: () => import('@/pages/base/bot'),
          //   meta: { title: 'AI智能体', keepAlive: true, permission: ['job:dirRoot', 'job:base', 'pai_bot'] }
          // }
        ]
      },
      {
        path: '/aibao',
        name: 'aibao_insurance',
        component: BlankLayout,
        meta: {
          title: '保险管理',
          keepAlive: true,
          icon: 'setting'
        },
        children: [
          {
            path: '/aibao/channel_list',
            name: 'aibao_channel',
            component: () => import('@/pages/aibao/channel-list'),
            meta: { title: '保险渠道', keepAlive: true, permission: ['job:dirRoot', 'aibao_insurance', 'aibao_channel'] }
          },
          {
            path: '/aibao/product_list',
            name: 'aibao_product',
            component: () => import('@/pages/aibao/product-list'),
            meta: { title: '保险产品', keepAlive: true, permission: ['job:dirRoot', 'aibao_insurance', 'aibao_product'] }
          }
        ]
      },
      // {
      //   path: '/agent',
      //   name: 'pai_agent',
      //   component: BlankLayout,
      //   meta: {
      //     title: '代理商',
      //     keepAlive: true,
      //     icon: 'setting'
      //   },
      //   children: [
      //     {
      //       path: '/agent/user',
      //       name: 'pai_agent_user',
      //       component: () => import('@/pages/agent/user'),
      //       meta: { title: '员工管理', icon: 'user', keepAlive: true, permission: ['job:dirRoot', 'pai_agent', 'pai_agent_user'] }
      //     }
      //   ]
      // },
      // {
      //   path: '/order',
      //   name: 'pai_order',
      //   component: BlankLayout,
      //   meta: {
      //     title: '订单管理',
      //     keepAlive: true,
      //     icon: 'setting'
      //   },
      //   children: [
      //     {
      //       path: '/order/list',
      //       name: 'pai_order_list',
      //       component: () => import('@/pages/admin/order'),
      //       meta: { title: '订单列表', keepAlive: true, permission: ['job:dirRoot', 'pai_order', 'pai_order_list'] }
      //     }
      //   ]
      // },
      // {
      //   path: '/group',
      //   name: 'pai_group',
      //   component: BlankLayout,
      //   meta: {
      //     title: '微信群码',
      //     keepAlive: true,
      //     icon: 'setting'
      //   },
      //   children: [
      //     {
      //       path: '/group/list',
      //       name: 'pai_group_list',
      //       component: () => import('@/pages/group/list'),
      //       meta: { title: '微信群码', icon: 'user', keepAlive: true, permission: ['job:dirRoot', 'pai_group', 'pai_group_list'] }
      //     }
      //   ]
      // }
    ]
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/user/login'),
        meta: { title: '管理后台' }
      }
    ]
  },
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "fail" */ '@/pages/404/index')
  }
]
